Page({
  goLogin() {
    wx.navigateTo({
      url: '/pages/login/index',
    })
  },
  data: {
    userInfo: {},
  },
  onShow() {
    //未登录则不发起请求
    const app = getApp()
    app.token && this.getUserInfo()
  },
  async getUserInfo() {
    const { data } = await wx.http.get('/userInfo')
    this.setData({ userInfo: data })
  },
})
